package com.zy.web.demo.wenjian;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class GetFile {

    ArrayList<Object> list=new ArrayList<Object>();

    public List<Object> getFiles(File file){

        File[] a=file.listFiles();

        for(File file1:a){

            if(file1.isDirectory()){

                getFiles(new File(file1.getAbsolutePath()));

            }else if(file1.isFile()){

                this.list.add(file1.getAbsolutePath());

            }
        }
        return list;

    }

    public static void main(String[] args) {

        List<Object> list=new GetFile().getFiles(new File("E:\\zy\\超星项目\\镜像小组\\GroupTopic_WEB-Image"));

        for(Object obj:list){

            System.out.println(obj);

        }
        System.out.println("文件总数："+list.size());
    }

}
